#ifndef D3DUTIL_H
#define D3DUTIL_H

#if defined(DEBUG) || defined(_DEBUG)
#ifndef D3D_DEBUG_INFO
#define D3D_DEBUG_INFO
#endif
#endif

#include "d3d9.h"
#include "d3dx9.h"
#include "dxerr.h"
#include <string>
#include <sstream>
#include <iostream>

#include "DirectInput.h"
#include "Vertex.h"

// Forward declaration
class D3DApp;
extern D3DApp* gd3dApp;
extern IDirect3DDevice9* gd3dDevice;

#define ReleaseCOM(x) { if(x){ x->Release(); x = 0;} }

#if defined(DEBUG) || defined(_DEBUG)
	#ifndef HR
	#define HR(x)										\
	{													\
		HRESULT hr = x;									\
		if(FAILED(hr))									\
		{												\
			DXTrace(__FILE__, __LINE__, hr, #x, TRUE);	\
		}												\
	}								
	#endif
#else
	#ifndef HR
	#define HR(x) x;
	#endif
#endif

#endif // D3DUTIL_H